<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>mamma</title>
<link rel="shortcut icon" href="../image/icon_mamma.ico">

<script src="../js/jquery-2.1.1.js"></script>
<script type="text/javascript" src="../js/nicEdit.js"></script> 
<script type="text/javascript">
$(document).ready(function() {
	
	$('#save').on('click', saveform);	
	
	bkLib.onDomLoaded(function() {
		myNicEditor = new nicEditor(
		{fullPanel : true})
		.panelInstance('content');
		});
});

function saveform() {
	var id = "<s:property value = 'vac.id'/>";
	var startMonth = $('#startMonth').val();
	var endMonth = $('#endMonth').val();
	var title = $('#title').val();
	
	var nicE = new nicEditors.findEditor('content');
	content = nicE.getContent();
	
	if (title.length == 0) {
		alert('제목입력');
		return false;
	}
	if (content.length == 0) {
		alert('내용입력');
		return false;
	}
	
	if (startMonth.length == 0) {
		alert('시작개월입력');
		return false;
	}
	
	if (endMonth.length == 0) {
		alert('종료개월입력');
		return false;
	}
	
	if (startMonth > endMonth) {
		alert('시작개월을 다시입력해 주세요');
		return false;
	}
	
	$.ajax({
		url: 'jupdate.action',
		type: 'POST',
		dataType: 'json',
		data: {id:id , title:title, content:content, startMonth:startMonth , endMonth:endMonth},
		success: saveOK
	});
	
	function saveOK() {	
		location.href='../admin/goJusalistPage.action';
	}
}
</script>

<style type="text/css">
	
	table.maintable{margin:0 auto; border: thin; border-color: #BDBDBD;border-style: solid;table-layout: fixed;}
	th{text-align: center;background-color: #EAEAEA;width:100px; text-indent: 5px;border-bottom: thin; border-bottom-style: solid; border-bottom-color: #BDBDBD;}
	td{width:800px;border-bottom: thin; border-bottom-style: solid; border-bottom-color: #BDBDBD;}
	.content{border: 0px;}
	/* th{text-align: center;background-color: #EAEAEA;width:100px; text-indent: 5px;border-bottom: thin; border-bottom-style: solid; border-bottom-color: #BDBDBD;}
	.thcontent{border: 0px;}
	.adth{border: 0px;}
	td{width:800px;border-bottom: thin; border-bottom-style: solid; border-bottom-color: #BDBDBD;}
	.title{height:50px; font-size: 18px;font-weight: bold;}
	.content{height:300px;border: 0px;}
	.adtd{border: 0px;}
	h1{text-align: center;}
	input{width: 100px;font-size: 20px;}
	textarea {resize:none;}  */

	
	
</style>
</head>
<body topmargin="0"  leftmargin="0" rightmargin="0">
<table id="adhead" border="0" width="100%" height="100px" style="text-align: center;background-color: #EAEAEA;">
<tr>
<td>	
	<a href="../admin/goNoticelistPage.action">공지 관리</a>
	<a href="../admin/goJusalistPage.action">백신 알림</a>
	<a href="../admin/goMemberlistPage.action">회원 목록 보기</a>
	<a href="../admin/goAdBannerPage.action">광고 관리</a>
	<a href="../account/logout.action">로그아웃</a>
</td>
</tr></table>
<h1 style="text-align: center;">[백신 알림 수정]</h1>
<br><br>
<table class="maintable">
<tr>
<th style="text-align: center;background-color: #EAEAEA;">시작개월</th>
<td>
		<select id="startMonth">
			<option><s:property value = 'vac.startMonth'/></option>
			<s:iterator var="sm" begin="0" end="100">
			<option value="${sm}">${sm}</option>
			</s:iterator>
		</select>
	</td>
</tr>
<tr>
	<th width="100" style="text-align: center;background-color: #EAEAEA;">종료개월</th>
	<td>
		<select id="endMonth">
			<option><s:property value = 'vac.endMonth'/></option>
			<s:iterator var="em" begin="0" end="100">
			<option value="${em}">${em}</option>
			</s:iterator>
		</select>
	</td>
</tr>

<tr>
	<th width="100" style="text-align: center;background-color: #EAEAEA;">제목</th>
	<td>
		<s:textfield id="title" cssStyle="width:800px;" theme="simple" name="vac.title" />
	</td>
</tr>
<tr>
	<th width="100" style="text-align: center;background-color: #EAEAEA;">내용</th> 
	<td class="content">
		<s:textarea id="content" cssStyle="width:800px;height:300px;resize:none;" theme="simple" name="vac.content"></s:textarea>
	</td>
</tr>
</table>

<br>
<form style="text-align: center;">
<input type="button" id="save" value="저장" style="width: 100px;">
</form>

</body>
</html>